// replace 逐个替换数字

// 1234567890 -> (123) 456-7890
// replace 方法

let numbs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];

function createPhoneNumber(numbers) {
    var format = "(xxx) xxx-xxxx";
    for (let i = 0; i < numbers.length; i++) {
        format = format.replace('x', numbers[i]);
    }
    return format;
}
console.log(createPhoneNumber(numbs));